import * as Router from 'koa-router';
import controller = require('./controller');
import { middlewareParseSession } from './utils/middleware/parseCtxSession'

const router = new Router();
router.use(middlewareParseSession)

// USER ROUTES
router.post('/api/user', controller.user.createUser)
router.get('/api/user', controller.user.getUser)
router.put('/api/user', controller.user.updateUser)

// project ROUTES
router.post('/api/project', controller.project.createProject)
router.get('/api/project', controller.project.getProjectAll)
router.get('/api/project/:id', controller.project.getProject)
router.put('/api/project', controller.project.updateProject)

// HTML
router.get('/', controller.html.index)

router.post('/api/file/upload',
  controller.file.getUploadConfig(),
  controller.file.onFileUpload
);
router.post('/api/upload/json', controller.file.uploadHTML);
router.get('/upload', controller.html.uploadFilePage);

// Sketch Design File
router.get('/project/:id', controller.html.sketchDesignHTML);
router.get('/project', controller.html.projectIndex);


export { router };
